package com.idrive.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {

	private static final String DATABASE_NAME = "idrive.db";
	private static final int DATABASE_VERSION = 1;

	private static DatabaseHelper uniqueInstance;

	public static void init(Context context) {
		if (uniqueInstance == null) {
			uniqueInstance = new DatabaseHelper(context);
		}
	}

	public static DatabaseHelper getInstance() {
		return uniqueInstance;
	}

	
	public void close() {
		uniqueInstance.close();
	}

	private DatabaseHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	// Method is called during creation of the database
	@Override
	public void onCreate(SQLiteDatabase database) {
		DatabaseUtility.onCreate(database);
		
		
	}

	// Method is called during an upgrade of the database,
	// e.g. if you increase the database version
	@Override
	public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
		DatabaseUtility.onUpgrade(database, oldVersion, newVersion);
	}
}
